package com.doushu.dispatch.controller;

import com.doushu.dispatch.common.dto.ResultDto;
import com.doushu.dispatch.service.DataVerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(description = "数据验证controller")
public class DataVerController {

    @Autowired
    private DataVerService dataVerService;

    @RequestMapping(value = "/carDataUpVer", method = RequestMethod.POST)
    @ApiOperation(value = "直通车关键词数据验证", httpMethod = "POST")
    public ResultDto carDataUpVer(
            @ApiParam(name = "shopId",value="店铺id",required = true,example = "0")@RequestParam Long shopId,
            @ApiParam(name = "datatime",value="数据日期",required = true)@RequestParam String datatime) {
        return dataVerService.carDataUpVer(shopId,datatime);
    }

    @RequestMapping(value = "/itemsEffectDetailUpVer", method = RequestMethod.POST)
    @ApiOperation(value = "商品列表数据验证", httpMethod = "POST")
    public ResultDto itemsEffectDetailUp(
            @ApiParam(name = "shopId",value="店铺id",required = true,example = "0")@RequestParam Long shopId){
        return dataVerService.itemsEffectDetailUpVer(shopId);
    }

    @RequestMapping(value = "/listFlowFromUpVer", method = RequestMethod.POST)
    @ApiOperation(value = "商品来源数据验证", httpMethod = "POST")
    public ResultDto listFlowFromUp(
            @ApiParam(name = "shopId",value="店铺id",required = true,example = "0")@RequestParam Long shopId,
            @ApiParam(name = "datatime",value="数据日期",required = true)@RequestParam String datatime,
            @ApiParam(name = "itemId",value="商品id",required = true,example = "0")@RequestParam Long itemId){
        return dataVerService.listFlowFromUpVer(shopId,datatime,itemId);
    }

    @RequestMapping(value = "/itemKeywordsUpVer", method = RequestMethod.POST)
    @ApiOperation(value = "关键词效果分析数据验证", httpMethod = "POST")
    public ResultDto itemKeywordsUp(
            @ApiParam(name = "shopId",value="店铺id",required = true,example = "0")@RequestParam Long shopId,
            @ApiParam(name = "datatime",value="数据日期",required = true)@RequestParam String datatime,
            @ApiParam(name = "itemId",value="商品id",required = true,example = "0")@RequestParam Long itemId){
        return dataVerService.itemKeywordsUpVer(shopId,datatime,itemId);
    }
}
